#include <signal.h>
#include <unistd.h>

/****
 * sleep简化并不完整的实现
 **/

static void sig_alrm(int signo)
{
    return;
}

unsigned int sleep1(unsigned int nsecs)
{
    if(signal(SIGALRM, sig_alrm) == SIG_ERR)
    {
        return (nsecs);
    }
    alarm(nsecs);
    pause();
    return (alarm(0));
}
